package com.LeeCode;

/**
 * 只出现一次的数字
 */
public class Code136 {
    public static void main(String[] args) {
        int[] nums = {4,1,2,1,2};
        System.out.println(new Code136().singleNumber(nums));
    }

    public int singleNumber(int[] nums) {
        int res = 0;
        for (int i = 0; i < nums.length; i++) {
            res = res ^ nums[i];
        }
        return res;
    }
}
